<?php
namespace WebAdmin\Controller;
use WebAdmin\Controller\BaseController;
class GroupController extends BaseController {

	//ThinkPHP的构造函数
	public function _initialize() {
		//自动加载的类
		parent::_initialize();
		new \Org\Admin_autoload();
	}

    public function index(){
    	$this->assign('page_title','管理员组别');
    	$GroupModel = D("Group");
    	$items = $GroupModel->select();
    	$this->assign('volist',$items);
    	$this->assign('colNames',json_encode(array('组ID','组别名称')));
    	//$this->assign('')
        $this->display();
    }
    
    public function add(){
    	if(!empty($_POST)) {
    		$GroupModel = D("Group");
    		$data = $GroupModel->create($_POST);
    		$insert_id = $GroupModel->add($data);
    		if($insert_id){
    			//$this->success('组别新增成功！',__APP__.'/index.php/Group/index/');
    			header("Content-type: text/html; charset=utf-8");
    			echo "<script>layer.closeAll(); \$table.trigger(\"reloadGrid\");</script>";exit;
    		}
    	}else{
    		$this->assign('common_hide_header',true);
    	    $this->display();
    	}
    }
    
       
    
}